//
//  ViewController.m
//  functionGuidance(新功能引导)~demo
//
//  Created by 石虎 on 2017/9/5.
//  Copyright © 2017年 石虎. All rights reserved.
//

#import "ViewController.h"
#import "SHTFreshGuideView.h"


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor orangeColor];
    
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self makeFunctionGuide];
}

#pragma mark - 新功能引导
- (void)makeFunctionGuide{
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *isFirstTimeGuiding = @"SHTFreshGuideView";
    
    if (![user boolForKey:isFirstTimeGuiding]) {
        [user setBool:YES forKey:isFirstTimeGuiding];
        [user synchronize];
        [self makeGuideView];
    }
}

- (void)makeGuideView {
    
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    SHTFreshGuideView *guideView = [[NSBundle mainBundle] loadNibNamed:@"SHTFreshGuideView" owner:nil options:nil].firstObject;
    guideView.frame = window.bounds;
    [window addSubview:guideView];
}

@end
